package dk.flashnotes.fff.googleAnalytics {
	import flash.display.DisplayObject;	
	
	import dk.flashnotes.fff.utils.XMLDataHolder;	
	
	import flash.display.DisplayObjectContainer;		

	/**
	 * @author jk
	 */
	public class GABaseConfig extends XMLDataHolder {

		public static const sBRIDGE_MODE : String="Bridge";
		public static const sAS3 : String = "AS3";

		private var _doDisplayObject : DisplayObjectContainer;
		private var _xmlBaseConfigData : XML;
		private var _bLive : Boolean=false;
		public function GABaseConfig(xmlBaseConfigData : XML, doDisplayObjet : DisplayObjectContainer) {
			_doDisplayObject = doDisplayObjet;			_xmlBaseConfigData = xmlBaseConfigData;
			super(xmlBaseConfigData);
		}
		
		public function get sAccountID() : String {
			if (!get_sTextStringFromChildNode('account')) {
				throw new Error("No 'account' specified in GA config xml");
			}
			return get_sTextStringFromChildNode('account');
		}
		
		public function get docDisplayObjectContainer() : DisplayObjectContainer { 
			return _doDisplayObject; 
		}
		
		public function get bVisiualDebug() : Boolean {
			return false;
			/* 
			if (get_sTextStringFromChildNode('visual_debug')==null) {
				throw new Error("No 'visual_debug' specified in GA config xml", false);
			}
			return get_bBooleanFromChildNode('visual_debug');
			 * 
			 */ 
		}
		
		public function get bLive() : Boolean { 
			if (get_sTextStringFromChildNode('live')==null) {
				throw new Error("No 'live' specified in GA config xml", false);
			}
			return get_bBooleanFromChildNode('live'); 
		}
		
		public function get sMode() : String { 
			if (!get_sTextStringFromChildNode('mode')) {
				throw new Error("No 'mode' specified in GA config xml");
			}
			return get_sTextStringFromChildNode('mode', 'AS3');
		}
		
		public function get sPageUrlPreString() : String { 
			if (!get_sTextStringFromChildNode('pre_string')) {
				throw new Error("No 'pre_string' specified in GA config xml");
			}
			return get_sTextStringFromChildNode('pre_string');
		}
		
	}
}
